package org.jeeasy.generate.emuns;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jeeasy.common.core.enums.IDictEnum;


@Getter
@AllArgsConstructor
public enum JavaTypeEnum implements IDictEnum<String> {
    STRING("String", "string"),
    INTEGER("Integer", "number"),
    LONG("Long", "number"),
    DOUBLE("Double", "number"),
    FLOAT("Float", "number"),
    BOOLEAN("Boolean", "boolean"),
    DATE("LocalDate", "number"),
    TIME("LocalTime", "number"),
    DATETIME("LocalDateTime", "number"),
    CHAR("char", "string"),
    BYTE("Byte", "number"),
    SHORT("Short", "number"),
    BIG_DECIMAL("BigDecimal", "number"),
    BIG_INTEGER("BigInteger", "number"),
    ;
    private final String value;
    private final String tsType;

    @Override
    public String getText() {
        return this.value;
    }

    public static JavaTypeEnum getByValue(String value) {
        for (JavaTypeEnum item : values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return STRING;
    }
}
